/*
 * File:   entity.h
 * Author: Administrateur
 *
 * Created on 4 d�cembre 2008, 20:38
 */

#ifndef _ENTITY_H
#define	_ENTITY_H

#include"Position.h"
#include "TypeEntity.h"
#include<iostream>

using namespace std;

class Ecosystem;

class Entity {
public:
    Entity(Ecosystem & _eco, Position const& _position, string _race, int _lifePoints)
            : eco(_eco), position(_position), race(_race), lifePoints(_lifePoints) {}

	/**
	 * Get the race of the entity
	 *
	 * @return Race of the entity (FOX, RABBIT, WOLF, ...)
	 */
	string getRace() const { return race; }

	/**
	 * Get the position of the entity
	 *
	 * @return constant reference of the position of the entity
	 */
	Position const& getPosition() const { return position; }

	/**
	 * Pure virtual method. It has to be defined by child classes.
	 * This method changes the status of the Vegetal
	 */
	virtual void update() = 0;

	/**
	 * Type of the entity (Animal or Vegetal)
	 * Has to be defined by child classes!!
	 *
	 */
	virtual TypeEntity getTypeEntity() const = 0;

	/**
	 * Virtual destructor
	 */
	virtual ~Entity() {}

        /**
         *  Set the number of lifepoint of the entity.  Used when an animal gets wounded or killed.
         *
         *  @param lp New life points
         **/
	void setLifePoints(int lp) { lifePoints = lp; }

protected:
	Ecosystem &         eco;
	Position            position;
	string		    race;
	int                 lifePoints;
};

#endif	/* _ENTITY_H */

